<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="/wondershare/js/jquery.js"></script> 
<script src="/wondershare/js/jquery.cvbox.min.js"></script> 
<link href="/wondershare/styles/main.css" rel="stylesheet" type="text/css" />
<link href="/wondershare/styles/general.css" rel="stylesheet" type="text/css" />
</head>
<body >
<h1>
    <span id="search_id" class="action-span1"> 增加我的任务 </span>
    <div style="clear:both"></div>
</h1>
<div id="tabbody-div"  style=" width:1100px;">
    <form  name="theForm" method="post" action="/wondershare/task_manage.php?action=editSubmit" onsubmit="return checkSubmit();">
        <table align="center" width="90%" id="general-table">
        <tbody>
            <tr>
                <td class="label">任务名称：</td>
                <td>
                	<textarea cols="60" rows="4" id="Name" name="Name"></textarea>
 					<span class="require-field">最多输入200个字符</span>
                </td>
            </tr>
            <tr>
                <td class="label">任务是否为FTP传：</td>
                <td>
                    <select name="IsFtp"  id="IsFtp"   style="width:450px;" >
                    <option value="0" <{if $IsFtp == 0}> selected="selected" <{/if}> >否</option>
                    <option value="1" <{if $IsFtp == 1}> selected="selected" <{/if}> >是</option>
                    </select>
        
                </td>
            </tr>
            <tr>
                <td class="label">任务所属域名：</td>
                <td>
                    <select name="sId"  id="sId"  style="width:450px;" >
                    <{$site_option}>
                    </select>
        
                </td>
            </tr>
             
            <tr>
                <td class="label">任务描述：</td>
                <td>
                    <textarea cols="60" rows="6" id="Description" name="Description"></textarea>
                    <span class="require-field">最多输入255个字符</span>
                </td>
            </tr>  
        </tbody>
        </table>
        <div  style="margin-left:380px; margin-top:20px;">
        <input type="hidden" value="<{$type}>" name="type" id="type" />
        <input type="hidden"  name="siteName" id="siteName" />
        <input type="hidden"  name="back_url" id="back_url"  value="<{$back_url}>"/>
        <input type="hidden" value="<{$form_act}>" name="act" id="act" />
        <input type="submit"   class="button" value="<{$form_value}> " name="sub_from" id='sub_from' />
        <input type="reset" class="button" value=" 重置 ">
        </div>
    </form>
</div>

<script>
//验证提交的数据
function checkSubmit() {
	
	var Name = $('#Name').val().replace(/(^\s*)|(\s*$)/g, "");
	var IsFtp = $('#IsFtp').val();
	var sId = $('#sId').val();
	var type = $('#type').val();
	var siteName = $("#sId").find("option:selected").text();
	$("#siteName").val(siteName);
	
	if ( Name == '' ) {
		alert('任务名称不能为空！');
		$("#Name").focus();
		return false;
	}
	
	//查看用户是否已经有具体网站的未完成任务
	var fage = false;

	$.ajax({
			async:false, 
			url:'/wondershare/task_manage.php?action=ajaxTask', 
			data:{sId:sId, type:type, IsFtp:IsFtp, action_type:'is_exist_site_task'}, 
			success:function(data)
			{
				
				if ( data == 'no') {
					fage = true;
				} else if( data == 'yes'){
					alert('你已经有改网站的未完成任务,请先完成!\n再来增加该网站新的任务！');
				} else {
					alert(data);
				}
				
			}
		});

	if ( !fage ) {
		return false;
	}
	
	return true;
	
}


	
</script>
</body>
</html>